package com.example.roadeyeserver.enums;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.example.roadeyeserver.constant.ProjectConstant;
import com.example.roadeyeserver.entity.report.CrossOverviewStatisticReport;
import com.example.roadeyeserver.entity.report.CrossStationStatisticReport;
import com.example.roadeyeserver.entity.vo.CarTypeVO;
import com.example.roadeyeserver.entity.vo.GantryHourFlowWideVO;
import com.example.roadeyeserver.entity.vo.StationHourFlowWideVO;
import com.example.roadeyeserver.interfaces.FlowFields;

import java.util.*;

public enum CarTypeEnum {
    VHC1("vhc_1", "一型客车"),
    VHC2("vhc_2", "二型客车"),
    VHC3("vhc_3", "三型客车"),
    VHC4("vhc_4", "四型客车"),
    VHC11("vhc_11", "一型货车"),
    VHC12("vhc_12", "二型货车"),
    VHC13("vhc_13", "三型货车"),
    VHC14("vhc_14", "四型货车"),
    VHC15("vhc_15", "五型货车"),
    VHC16("vhc_16", "六型货车"),
    VHC21("vhc_21", "一型专项作业车"),
    VHC22("vhc_22", "二型专项作业车"),
    VHC23("vhc_23", "三型专项作业车"),
    VHC24("vhc_24", "四型专项作业车"),
    VHC25("vhc_25", "五型专项作业车"),
    VHC26("vhc_26", "六型专项作业车"),
    JZX("jzx", "集装箱车");

    // 字段
    private final String field;
    // 名称
    private final String name;

    CarTypeEnum(String field, String name) {
        this.field = field;
        this.name = name;
    }

    public String getField() {
        return field;
    }

    public String getName() {
        return name;
    }

    /**
     * 获取所有车辆类型
     * @return
     */
    public static List<CarTypeVO> getAllCarType() {
        List<CarTypeVO> list = new ArrayList<>();
        for (CarTypeEnum value : values()) {
            // 不是专项车的才展示
            if (!value.name.contains("专项作业车")) {
                CarTypeVO carTypeVO = new CarTypeVO();
                carTypeVO.setField(value.getField());
                carTypeVO.setName(value.getName());
                list.add(carTypeVO);
            }
        }
        return list;
    }

    /**
     * 计算车辆类型流量并赋值(对象版本)
     * @param carTypeChoose
     * @param flowObject
     * @param <T>
     */
    public static <T extends FlowFields> void calculateAndSetObjectFlow(String carTypeChoose, T flowObject) {
        if (flowObject == null) {
            return;
        }
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        // 总流量
        Integer carTypeChooseTotalFlow = 0;
        // 客车流量
        Integer carTypeChooseBusFlow = 0;
        // 货车流量
        Integer carTypeChooseTruckFlow = 0;
        if (carTypeList.contains(VHC1.getField()) && flowObject.getVhc1() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc1();
            carTypeChooseBusFlow += flowObject.getVhc1();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getVhc2() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc2();
            carTypeChooseBusFlow += flowObject.getVhc2();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getVhc3() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc3();
            carTypeChooseBusFlow += flowObject.getVhc3();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getVhc4() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc4();
            carTypeChooseBusFlow += flowObject.getVhc4();
        }
        // 所选车型客车流量
        flowObject.setBusFlow(carTypeChooseBusFlow);
        if (carTypeList.contains(VHC11.getField()) && flowObject.getVhc11() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc11();
            carTypeChooseTruckFlow += flowObject.getVhc11();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getVhc12() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc12();
            carTypeChooseTruckFlow += flowObject.getVhc12();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getVhc13() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc13();
            carTypeChooseTruckFlow += flowObject.getVhc13();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getVhc14() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc14();
            carTypeChooseTruckFlow += flowObject.getVhc14();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getVhc15() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc15();
            carTypeChooseTruckFlow += flowObject.getVhc15();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getVhc16() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc16();
            carTypeChooseTruckFlow += flowObject.getVhc16();
        }
        // 所选车型货车流量
        flowObject.setTruckFlow(carTypeChooseTruckFlow);
        // 对总流量赋值为所选车型总流量
        flowObject.setTotalFlow(carTypeChooseTotalFlow);
    }

    /**
     * 计算车辆类型流量并赋值(列表版本)
     * @param carTypeChoose 车辆类型选择
     * @param flowObjectList 流量对象列表
     * @param <T> 实现了FlowFields接口的类型
     */
    public static <T extends FlowFields> void calculateAndSetListFlow(String carTypeChoose, List<T> flowObjectList) {
        if (CollectionUtil.isEmpty(flowObjectList)) {
            return;
        }
        for (T flowObject : flowObjectList) {
            calculateAndSetObjectFlow(carTypeChoose, flowObject);
        }
    }

    public static void calculateAndSetObjectFlowUpDownObjectFlow(String carTypeChoose, CrossOverviewStatisticReport flowObject) {
        if (flowObject == null) {
            return;
        }
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        // 总流量
        Integer carTypeChooseTotalFlow = 0;
        // 客车流量
        Integer carTypeChooseBusFlow = 0;
        // 货车流量
        Integer carTypeChooseTruckFlow = 0;
        // 上行流量
        Integer carTypeChooseUpFlow = 0;
        // 下行流量
        Integer carTypeChooseDownFlow = 0;
        if (carTypeList.contains(VHC1.getField()) && flowObject.getVhc1() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc1();
            carTypeChooseBusFlow += flowObject.getVhc1();
        }
        if (carTypeList.contains(VHC1.getField()) && flowObject.getUpVhc1() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc1();
        }
        if (carTypeList.contains(VHC1.getField()) && flowObject.getDownVhc1() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc1();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getVhc2() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc2();
            carTypeChooseBusFlow += flowObject.getVhc2();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getUpVhc2() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc2();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getDownVhc2() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc2();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getVhc3() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc3();
            carTypeChooseBusFlow += flowObject.getVhc3();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getUpVhc3() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc3();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getDownVhc3() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc3();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getVhc4() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc4();
            carTypeChooseBusFlow += flowObject.getVhc4();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getUpVhc4() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc4();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getDownVhc4() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc4();
        }
        // 所选车型客车流量
        flowObject.setBusFlow(carTypeChooseBusFlow);
        if (carTypeList.contains(VHC11.getField()) && flowObject.getVhc11() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc11();
            carTypeChooseTruckFlow += flowObject.getVhc11();
        }
        if (carTypeList.contains(VHC11.getField()) && flowObject.getUpVhc11() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc11();
        }
        if (carTypeList.contains(VHC11.getField()) && flowObject.getDownVhc11() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc11();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getVhc12() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc12();
            carTypeChooseTruckFlow += flowObject.getVhc12();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getUpVhc12() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc12();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getDownVhc12() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc12();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getVhc13() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc13();
            carTypeChooseTruckFlow += flowObject.getVhc13();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getUpVhc13() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc13();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getDownVhc13() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc13();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getVhc14() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc14();
            carTypeChooseTruckFlow += flowObject.getVhc14();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getUpVhc14() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc14();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getDownVhc14() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc14();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getVhc15() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc15();
            carTypeChooseTruckFlow += flowObject.getVhc15();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getUpVhc15() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc15();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getDownVhc15() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc15();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getVhc16() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc16();
            carTypeChooseTruckFlow += flowObject.getVhc16();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getUpVhc16() != null) {
            carTypeChooseUpFlow += flowObject.getUpVhc16();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getDownVhc16() != null) {
            carTypeChooseDownFlow += flowObject.getDownVhc16();
        }
        // 所选车型货车流量
        flowObject.setTruckFlow(carTypeChooseTruckFlow);
        // 对总流量赋值为所选车型总流量
        flowObject.setTotalFlow(carTypeChooseTotalFlow);
        // 所选车型上行流量
        flowObject.setUpFlow(carTypeChooseUpFlow);
        // 所选车型下行流量
        flowObject.setDownFlow(carTypeChooseDownFlow);
    }

    public static void calculateAndSetObjectFlowUpDownListFlow(String carTypeChoose, List<CrossOverviewStatisticReport> flowObjectList) {
        if (CollectionUtil.isEmpty(flowObjectList)) {
            return;
        }
        for (CrossOverviewStatisticReport flowObject : flowObjectList) {
            calculateAndSetObjectFlowUpDownObjectFlow(carTypeChoose, flowObject);
        }
    }

    public static void calculateAndSetObjectFlowInOutObjectFlow(String carTypeChoose, CrossStationStatisticReport flowObject) {
        if (flowObject == null) {
            return;
        }
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        // 总流量
        Integer carTypeChooseTotalFlow = 0;
        // 客车流量
        Integer carTypeChooseBusFlow = 0;
        // 货车流量
        Integer carTypeChooseTruckFlow = 0;
        // 入口流量
        Integer carTypeChooseInFlow = 0;
        // 出口流量
        Integer carTypeChooseOutFlow = 0;
        if (carTypeList.contains(VHC1.getField()) && flowObject.getVhc1() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc1();
            carTypeChooseBusFlow += flowObject.getVhc1();
        }
        if (carTypeList.contains(VHC1.getField()) && flowObject.getInVhc1() != null) {
            carTypeChooseInFlow += flowObject.getInVhc1();
        }
        if (carTypeList.contains(VHC1.getField()) && flowObject.getOutVhc1() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc1();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getVhc2() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc2();
            carTypeChooseBusFlow += flowObject.getVhc2();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getInVhc2() != null) {
            carTypeChooseInFlow += flowObject.getInVhc2();
        }
        if (carTypeList.contains(VHC2.getField()) && flowObject.getOutVhc2() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc2();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getVhc3() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc3();
            carTypeChooseBusFlow += flowObject.getVhc3();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getInVhc3() != null) {
            carTypeChooseInFlow += flowObject.getInVhc3();
        }
        if (carTypeList.contains(VHC3.getField()) && flowObject.getOutVhc3() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc3();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getVhc4() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc4();
            carTypeChooseBusFlow += flowObject.getVhc4();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getInVhc4() != null) {
            carTypeChooseInFlow += flowObject.getInVhc4();
        }
        if (carTypeList.contains(VHC4.getField()) && flowObject.getOutVhc4() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc4();
        }
        // 所选车型客车流量
        flowObject.setBusFlow(carTypeChooseBusFlow);
        if (carTypeList.contains(VHC11.getField()) && flowObject.getVhc11() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc11();
            carTypeChooseTruckFlow += flowObject.getVhc11();
        }
        if (carTypeList.contains(VHC11.getField()) && flowObject.getInVhc11() != null) {
            carTypeChooseInFlow += flowObject.getInVhc11();
        }
        if (carTypeList.contains(VHC11.getField()) && flowObject.getOutVhc11() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc11();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getVhc12() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc12();
            carTypeChooseTruckFlow += flowObject.getVhc12();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getInVhc12() != null) {
            carTypeChooseInFlow += flowObject.getInVhc12();
        }
        if (carTypeList.contains(VHC12.getField()) && flowObject.getOutVhc12() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc12();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getVhc13() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc13();
            carTypeChooseTruckFlow += flowObject.getVhc13();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getInVhc13() != null) {
            carTypeChooseInFlow += flowObject.getInVhc13();
        }
        if (carTypeList.contains(VHC13.getField()) && flowObject.getOutVhc13() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc13();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getVhc14() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc14();
            carTypeChooseTruckFlow += flowObject.getVhc14();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getInVhc14() != null) {
            carTypeChooseInFlow += flowObject.getInVhc14();
        }
        if (carTypeList.contains(VHC14.getField()) && flowObject.getOutVhc14() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc14();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getVhc15() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc15();
            carTypeChooseTruckFlow += flowObject.getVhc15();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getInVhc15() != null) {
            carTypeChooseInFlow += flowObject.getInVhc15();
        }
        if (carTypeList.contains(VHC15.getField()) && flowObject.getOutVhc15() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc15();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getVhc16() != null) {
            carTypeChooseTotalFlow += flowObject.getVhc16();
            carTypeChooseTruckFlow += flowObject.getVhc16();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getInVhc16() != null) {
            carTypeChooseInFlow += flowObject.getInVhc16();
        }
        if (carTypeList.contains(VHC16.getField()) && flowObject.getOutVhc16() != null) {
            carTypeChooseOutFlow += flowObject.getOutVhc16();
        }
        // 所选车型货车流量
        flowObject.setTruckFlow(carTypeChooseTruckFlow);
        // 对总流量赋值为所选车型总流量
        flowObject.setTotalFlow(carTypeChooseTotalFlow);
        // 所选车型上行流量
        flowObject.setInFlow(carTypeChooseInFlow);
        // 所选车型下行流量
        flowObject.setOutFlow(carTypeChooseOutFlow);
    }

    public static void calculateAndSetObjectFlowInOutListFlow(String carTypeChoose, List<CrossStationStatisticReport> flowObjectList) {
        if (CollectionUtil.isEmpty(flowObjectList)) {
            return;
        }
        for (CrossStationStatisticReport flowObject : flowObjectList) {
            calculateAndSetObjectFlowInOutObjectFlow(carTypeChoose, flowObject);
        }
    }

    public static void setCarTypeObjectFLow(String carTypeChoose, GantryHourFlowWideVO flowObject) {
        if (flowObject ==  null) {
            return;
        }
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        if (!carTypeList.contains(VHC1.getField())) {
            flowObject.setVhc1(0);
        }
        if (!carTypeList.contains(VHC2.getField())) {
            flowObject.setVhc2(0);
        }
        if (!carTypeList.contains(VHC3.getField())) {
            flowObject.setVhc3(0);
        }
        if (!carTypeList.contains(VHC4.getField())) {
            flowObject.setVhc4(0);
        }
        if (!carTypeList.contains(VHC11.getField())) {
            flowObject.setVhc11(0);
        }
        if (!carTypeList.contains(VHC12.getField())) {
            flowObject.setVhc12(0);
        }
        if (!carTypeList.contains(VHC13.getField())) {
            flowObject.setVhc13(0);
        }
        if (!carTypeList.contains(VHC14.getField())) {
            flowObject.setVhc14(0);
        }
        if (!carTypeList.contains(VHC15.getField())) {
            flowObject.setVhc15(0);
        }
        if (!carTypeList.contains(VHC16.getField())) {
            flowObject.setVhc16(0);
        }
        if (!carTypeList.contains(VHC21.getField())) {
            flowObject.setVhc21(0);
        }
        if (!carTypeList.contains(VHC22.getField())) {
            flowObject.setVhc22(0);
        }
        if (!carTypeList.contains(VHC23.getField())) {
            flowObject.setVhc23(0);
        }
        if (!carTypeList.contains(VHC24.getField())) {
            flowObject.setVhc24(0);
        }
        if (!carTypeList.contains(VHC25.getField())) {
            flowObject.setVhc25(0);
        }
        if (!carTypeList.contains(VHC26.getField())) {
            flowObject.setVhc26(0);
        }
    }

    public static void setCarTypeListFLow(String carTypeChoose, List<GantryHourFlowWideVO> flowObjectList) {
        if (CollectionUtil.isEmpty(flowObjectList)) {
            return;
        }
        for (GantryHourFlowWideVO flowObject : flowObjectList) {
            setCarTypeObjectFLow(carTypeChoose, flowObject);
        }
    }


    public static void setCarTypeStationObjectFLow(String carTypeChoose, StationHourFlowWideVO flowObject) {
        if (flowObject ==  null) {
            return;
        }
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        if (!carTypeList.contains(VHC1.getField())) {
            flowObject.setVhc1(0);
        }
        if (!carTypeList.contains(VHC2.getField())) {
            flowObject.setVhc2(0);
        }
        if (!carTypeList.contains(VHC3.getField())) {
            flowObject.setVhc3(0);
        }
        if (!carTypeList.contains(VHC4.getField())) {
            flowObject.setVhc4(0);
        }
        if (!carTypeList.contains(VHC11.getField())) {
            flowObject.setVhc11(0);
        }
        if (!carTypeList.contains(VHC12.getField())) {
            flowObject.setVhc12(0);
        }
        if (!carTypeList.contains(VHC13.getField())) {
            flowObject.setVhc13(0);
        }
        if (!carTypeList.contains(VHC14.getField())) {
            flowObject.setVhc14(0);
        }
        if (!carTypeList.contains(VHC15.getField())) {
            flowObject.setVhc15(0);
        }
        if (!carTypeList.contains(VHC16.getField())) {
            flowObject.setVhc16(0);
        }
        if (!carTypeList.contains(VHC21.getField())) {
            flowObject.setVhc21(0);
        }
        if (!carTypeList.contains(VHC22.getField())) {
            flowObject.setVhc22(0);
        }
        if (!carTypeList.contains(VHC23.getField())) {
            flowObject.setVhc23(0);
        }
        if (!carTypeList.contains(VHC24.getField())) {
            flowObject.setVhc24(0);
        }
        if (!carTypeList.contains(VHC25.getField())) {
            flowObject.setVhc25(0);
        }
        if (!carTypeList.contains(VHC26.getField())) {
            flowObject.setVhc26(0);
        }
    }

    public static void setCarTypeStationListFLow(String carTypeChoose, List<StationHourFlowWideVO> flowObjectList) {
        if (CollectionUtil.isEmpty(flowObjectList)) {
            return;
        }
        for (StationHourFlowWideVO flowObject : flowObjectList) {
            setCarTypeStationObjectFLow(carTypeChoose, flowObject);
        }
    }

    public static Map<String, Integer> getSelectedCarTypeCountMap(String carTypeChoose, GantryHourFlowWideVO flowObject) {
        Map<String, Integer> carTypeCountMap = new HashMap<>();
        // 初始化carTypeCountMap,全置为0
        carTypeCountMap.put(VHC1.getField(), 0);
        carTypeCountMap.put(VHC2.getField(), 0);
        carTypeCountMap.put(VHC3.getField(), 0);
        carTypeCountMap.put(VHC4.getField(), 0);
        carTypeCountMap.put(VHC11.getField(), 0);
        carTypeCountMap.put(VHC12.getField(), 0);
        carTypeCountMap.put(VHC13.getField(), 0);
        carTypeCountMap.put(VHC14.getField(), 0);
        carTypeCountMap.put(VHC15.getField(), 0);
        carTypeCountMap.put(VHC16.getField(), 0);
        carTypeCountMap.put(ProjectConstant.BUS_FLOW, 0);
        carTypeCountMap.put(ProjectConstant.TRUCK_FLOW, 0);
        carTypeCountMap.put(ProjectConstant.TOTAL_FLOW, 0);
        if (flowObject == null) {
            return carTypeCountMap;
        }
        int vhc1 = flowObject.getVhc1() != null ? flowObject.getVhc1() : 0;
        int vhc2 = flowObject.getVhc2() != null ? flowObject.getVhc2() : 0;
        int vhc3 = flowObject.getVhc3() != null ? flowObject.getVhc3() : 0;
        int vhc4 = flowObject.getVhc4() != null ? flowObject.getVhc4() : 0;
        int vhc11 = flowObject.getVhc11() != null ? flowObject.getVhc11() : 0;
        int vhc12 = flowObject.getVhc12() != null ? flowObject.getVhc12() : 0;
        int vhc13 = flowObject.getVhc13() != null ? flowObject.getVhc13() : 0;
        int vhc14 = flowObject.getVhc14() != null ? flowObject.getVhc14() : 0;
        int vhc15 = flowObject.getVhc15() != null ? flowObject.getVhc15() : 0;
        int vhc16 = flowObject.getVhc16() != null ? flowObject.getVhc16() : 0;
        // 如果没有选择车型,则返回所有车型的
        if (StringUtils.isBlank(carTypeChoose)) {
            carTypeCountMap.put(VHC1.getField(), vhc1);
            carTypeCountMap.put(VHC2.getField(), vhc2);
            carTypeCountMap.put(VHC3.getField(), vhc3);
            carTypeCountMap.put(VHC4.getField(), vhc4);
            carTypeCountMap.put(VHC11.getField(), vhc11);
            carTypeCountMap.put(VHC12.getField(), vhc12);
            carTypeCountMap.put(VHC13.getField(), vhc13);
            carTypeCountMap.put(VHC14.getField(), vhc14);
            carTypeCountMap.put(VHC15.getField(), vhc15);
            carTypeCountMap.put(VHC16.getField(), vhc16);
            // 客车流量
            carTypeCountMap.put(ProjectConstant.BUS_FLOW, vhc1 + vhc2 + vhc3 + vhc4);
            // 货车流量
            carTypeCountMap.put(ProjectConstant.TRUCK_FLOW, vhc11 + vhc12 + vhc13 + vhc14 + vhc15 + vhc16);
            // 总流量
            carTypeCountMap.put(ProjectConstant.TOTAL_FLOW, vhc1 + vhc2 + vhc3 + vhc4 + vhc11 + vhc12 + vhc13 + vhc14 + vhc15 + vhc16);
            return carTypeCountMap;
        }
        // 所选车型在单个门架中的总流量
        int selectedCarTypeCount = 0;
        // 所选车型在单个门架中的客车总流量
        int selectedCarTypeBusCount = 0;
        // 所选车型在单个门架中的货车总流量
        int selectedCarTypeTruckCount = 0;
        // 车型列表
        List<String> carTypeList = Arrays.asList(carTypeChoose.split(ProjectConstant.COMMA));
        if (carTypeList.contains(VHC1.getField())) {
            selectedCarTypeCount += vhc1;
            selectedCarTypeBusCount += vhc1;
            carTypeCountMap.put(VHC1.getField(), vhc1);
        }
        if (carTypeList.contains(VHC2.getField())) {
            selectedCarTypeCount += vhc2;
            selectedCarTypeBusCount += vhc2;
            carTypeCountMap.put(VHC2.getField(), vhc2);
        }
        if (carTypeList.contains(VHC3.getField())) {
            selectedCarTypeCount += vhc3;
            selectedCarTypeBusCount += vhc3;
            carTypeCountMap.put(VHC3.getField(), vhc3);
        }
        if (carTypeList.contains(VHC4.getField())) {
            selectedCarTypeCount += vhc4;
            selectedCarTypeBusCount += vhc4;
            carTypeCountMap.put(VHC4.getField(), vhc4);
        }
        if (carTypeList.contains(VHC11.getField())) {
            selectedCarTypeCount += vhc11;
            selectedCarTypeTruckCount += vhc11;
            carTypeCountMap.put(VHC11.getField(), vhc11);
        }
        if (carTypeList.contains(VHC12.getField())) {
            selectedCarTypeCount += vhc12;
            selectedCarTypeTruckCount += vhc12;
            carTypeCountMap.put(VHC12.getField(), vhc12);
        }
        if (carTypeList.contains(VHC13.getField())) {
            selectedCarTypeCount += vhc13;
            selectedCarTypeTruckCount += vhc13;
            carTypeCountMap.put(VHC13.getField(), vhc13);
        }
        if (carTypeList.contains(VHC14.getField())) {
            selectedCarTypeCount += vhc14;
            selectedCarTypeTruckCount += vhc14;
            carTypeCountMap.put(VHC14.getField(), vhc14);
        }
        if (carTypeList.contains(VHC15.getField())) {
            selectedCarTypeCount += vhc15;
            selectedCarTypeTruckCount += vhc15;
            carTypeCountMap.put(VHC15.getField(), vhc15);
        }
        if (carTypeList.contains(VHC16.getField())) {
            selectedCarTypeCount += vhc16;
            selectedCarTypeTruckCount += vhc16;
            carTypeCountMap.put(VHC16.getField(), vhc16);
        }
        carTypeCountMap.put(ProjectConstant.BUS_FLOW, selectedCarTypeBusCount);
        carTypeCountMap.put(ProjectConstant.TRUCK_FLOW, selectedCarTypeTruckCount);
        carTypeCountMap.put(ProjectConstant.TOTAL_FLOW, selectedCarTypeCount);
        return carTypeCountMap;
    }
}
